<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>许可证</title>
    <link rel="stylesheet" type="text/css" th:href="@{'/common.css'}"/>
    <link type="text/css" rel="stylesheet" th:href="@{${skinPath} + '/css.css'}"/>
    <link th:href="@{/js/jquery-showLoading/showLoading.css}" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" th:href="@{/js/layui/css/layui.css}" media="all">
    <style>
        .table th, .table td {
            height: 26px;
            vertical-align: middle !important;
        }
    </style>
    <script src="../inc/common.js"></script>
    <script th:src="@{/js/jquery-1.9.1.min.js}" type="text/javascript"></script>
    <script th:src="@{/js/jquery-migrate-1.2.1.min.js}" type="text/javascript"></script>
    <script th:src="@{/js/layui/layui.js}" charset="utf-8"></script>
    <script th:src="@{/js/jquery-showLoading/jquery.showLoading.js}" type="text/javascript"></script>
</head>
<body>
<div class="spacerH"></div>
<div class="container" style="margin-top: 10px">
    <div class="row">
        <div class="col-lg-10 col-lg-offset-1">
            <div class="table-responsive">
                <th:block th:if="${isShowCurLicense}">
                    <table width="53%" border="0" align="center" cellpadding="0" cellspacing="0" class="tabStyle_1 percent80">
                        <tbody>
                        <tr>
                            <td colspan="2" align="left" class="tabStyle_1_title">&nbsp;许可证信息</td>
                        </tr>
                        <tr>
                            <td width="17%" align="left">授权单位</td>
                            <td width="83%" align="left">
                                [[${license.company}]]
                            </td>
                        </tr>
                        <tr>
                            <td width="17%" align="left">名称</td>
                            <td width="83%" align="left">
                                [[${license.name}]]
                            </td>
                        </tr>
                        <tr>
                            <td align="left">企业号</td>
                            <td align="left">
                                [[${enterpriseNum}]]
                            </td>
                        </tr>
                        <tr>
                            <td align="left">用户数</td>
                            <td align="left">[[${license.userCount}]]</td>
                        </tr>
                        <tr>
                            <td align="left">类型</td>
                            <td align="left" th:inline="text" th:text="${LicenseType}"></td>
                        </tr>
                        <tr>
                            <td align="left">到期时间</td>
                            <td align="left" th:text="${licenseExpiresDate}"></td>
                        </tr>
                        <tr>
                            <td align="left">域名</td>
                            <td align="left">[[${license.domain}]]</td>
                        </tr>
                        <tr>
                            <td align="left">绑定端口</td>
                            <td align="left">[[${portUnlimit}]]</td>
                        </tr>
                        <tr>
                            <td align="left">版本</td>
                            <td align="left">[[${versionType}]]</td>
                        </tr>
                        <tr>
                            <td align="left">试用版</td>
                            <td align="left">[[${licenseTrial}]]</td>
                        </tr>
                        <tr>
                            <td align="left">系统版本</td>
                            <td align="left">[[${version}]]</td>
                        </tr>
                        <tr>
                            <td align="left">系统补丁版本</td>
                            <td align="left">[[${spVersion}]]</td>
                        </tr>
                        <tr>
                            <td align="left">上传许可证文件</td>
                            <td align="left">
                                <form id="form1" name="addform" method="post" enctype="MULTIPART/FORM-DATA" action="uploadLicense">
                                    <input id="attachment" name="attachment" type="file"/>
                                    <input id="btnSubmit" class="btn" type="submit" value="上传"/>
                                </form>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center" style="padding: 5px">
                                <input class="btn" type="button" value="激活" th:onclick="window.location.href='sysActivate'"/>
                                &nbsp;&nbsp;
                                <input class="btn" type="button" onclick="window.location.href='index'" value="返回"/>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </th:block>
                <th:block th:unless="${isShowCurLicense}">
                    <table width="53%" border="0" align="center" cellpadding="0" cellspacing="0" class="tabStyle_1 percent80">
                        <tbody>
                        <tr>
                            <td colspan="2" align="left" class="tabStyle_1_title">&nbsp;上传的许可证信息</td>
                        </tr>
                        <tr>
                            <td width="17%" align="left">授权单位</td>
                            <td width="83%" align="left">
                                [[${lu.company}]]
                            </td>
                        </tr>
                        <tr>
                            <td width="17%" align="left">使用单位</td>
                            <td width="83%" align="left">
                                [[${lu.name}]]
                            </td>
                        </tr>
                        <tr>
                            <td align="left">企业号</td>
                            <td align="left">
                                [[${lu.enterpriseNum}]]
                            </td>
                        </tr>
                        <tr>
                            <td align="left">用户数</td>
                            <td align="left">
                                [[${lu.userCount}]]
                            </td>
                        </tr>
                        <tr>
                            <td align="left">类型</td>
                            <td align="left">
                                [[${type}]]
                            </td>
                        </tr>
                        <tr>
                            <td align="left">到期时间</td>
                            <td align="left">
                                [[${expiresDate}]]
                            </td>
                        </tr>
                        <tr>
                            <td align="left">域名</td>
                            <td align="left">
                                [[${lu.domain}]]
                            </td>
                        </tr>
                        <tr>
                            <td align="left">绑定端口</td>
                            <td align="left">[[${portUnlimit}]]</td>
                        </tr>
                        <tr>
                            <td align="left">版本</td>
                            <td align="left">[[${versionType}]]</td>
                        </tr>
                        <tr>
                            <td align="left">试用版</td>
                            <td align="left">
                                [[${isTrial}]]
                            </td>
                        </tr>
                        <tr>
                            <td align="left">系统版本</td>
                            <td align="left">
                                [[${version}]]
                            </td>
                        </tr>
                        <tr>
                            <td align="left">系统补丁版本</td>
                            <td align="left">
                                [[${spVersion}]]
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center" style="padding: 5px">
                                <input class="btn" id="btnChange" type="button" value="替换"/>
                                <script th:inline="javascript">
                                    $('#btnChange').click(function () {
                                        layer.confirm('您确定要替换么', {icon: 3, title: '提示'}, function (index) {
                                            layer.close();
                                            $.ajax({
                                                type: "POST",
                                                url: "changeLicense",
                                                data: {
                                                    "licFileName": [[${licFileName}]]
                                                },
                                                dataType: "json",
                                                beforeSend: function (XMLHttpRequest) {
                                                    $('body').showLoading();
                                                },
                                                success: function (res, status) {
                                                    if (res.code == 200) {
                                                        layer.alert(res.msg, {
                                                            btn: ['确定'],
                                                            yes: function() {
                                                                window.location.href = 'license';
                                                            }
                                                        });
                                                    } else {
                                                        layer.msg(res.msg, {
                                                            offset: '6px'
                                                        });
                                                    }
                                                },
                                                complete: function (XMLHttpRequest, status) {
                                                    $('body').hideLoading();
                                                },
                                                error:function(XMLHttpRequest, textStatus){
                                                    alert(XMLHttpRequest.responseText);
                                                }
                                            })
                                        });
                                    });
                                </script>
                                &nbsp;&nbsp;
                                <input class="btn" type="button" th:onclick="window.location.href='license'" value="返回"/>
                            </td>
                        </tr>
                        </tbody>
                    </table>

                </th:block>
            </div>
        </div>
    </div>
</div>
</body>
</html>